package exam.huawei;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

/**
 * @author chenhong
 * @version 1.0
 * @description TODO
 * @date 2023/4/14 19:59
 */
public class HJ27 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        String []words = new String[n];
        for (int i = 0; i < n; i++) {
            words[i] = in.next();
        }
        String source= in.next();
        int k = in.nextInt();
        ArrayList<String> list = new ArrayList<>();
        char[] source_chars = source.toCharArray();
        Arrays.sort(source_chars);
        String source_sorted = new String(source_chars);
        for (int i = 0; i < n; i++) {
            if(words[i].length() != source.length())
                continue;
            if(words[i].equals(source))
                continue;
            char[] chars = words[i].toCharArray();
            Arrays.sort(chars);
            if(new String(chars).equals(source_sorted)){
                list.add(words[i]);
            }
        }
        Collections.sort(list);
        System.out.println(list.size());
        if(k <= list.size())
            System.out.println(list.get(k - 1));
    }
}
